Platform Explorer / Nuxeo Platform 2021.47

Extension point datasources

Documentation

Example contribution:

    <datasource driverClassName="org.h2.Driver" maxTotal="20"
        maxWaitMillis="10000" minTotal="5" name="jdbc/foo">
        <property name="url">jdbc:h2:/home/db;DB_CLOSE_ON_EXIT=false;MODE=LEGACY
          </property>
        <property name="username">nuxeo</property>
        <property name="password">nuxeo</property>
    </datasource>

Or, for a XA datasource:

    <datasource maxTotal="20" maxWaitMillis="10000" minTotal="5"
        name="jdbc/foo" xaDataSource="org.h2.jdbcx.JdbcDataSource">
        <property name="databaseName">/home/db</property>
        <property name="createDatabase">create</property>
        <property name="user">nuxeo</property>
        <property name="password">nuxeo</property>
    </datasource>

The allowed attributes of a datasource

element are:

  • name the JNDI name (for instance jdbc/foo )
  • driverClassName the JDBC driver class name (only for a non-XA datasource)
  • xaDataSource the XA datasource class name (only for a XA datasource)

To configure the characteristics of the pool:

  • maxTotal the maximum number of active connections
  • minTotal the minimum number of idle connections
  • maxWaitMillis the maximum number of milliseconds to wait for a connection to be available, or -1 (the default) to wait indefinitely
  • ... see org.apache.commons.dbcp.BasicDataSource setters for more.

To configure the datasource, individual property sub-elements must be used. For a non-XA datasource, url

, username

and password

are commonly used. For a XA datasource, the properties are done according to the JavaBean setters of the datasource, see the documentation for your JDBC driver for more.

Contribution Descriptors

  • Class: org.nuxeo.runtime.datasource.DataSourceDescriptor
  • Class: org.nuxeo.runtime.datasource.DataSourceLinkDescriptor

Existing Contributions

Contributions are presented in the same order as the registration order on this extension point. This order is displayed before the contribution name, in brackets.

  • nuxeo-runtime-2021.47.4.jar /opt/nuxeo/server/nxserver/config/datasources-config.xml
    <?xml version='1.0' encoding='UTF-8'?>
    <extension point="datasources" target="org.nuxeo.runtime.datasource">
        <datasource accessToUnderlyingConnectionAllowed="true" cacheState="false" driverClassName="org.h2.Driver" maxTotal="100" maxWaitMillis="1000" minTotal="5" name="jdbc/nuxeo" password="********" url="jdbc:h2:/var/lib/nuxeo/h2/nuxeo;DB_CLOSE_ON_EXIT=false;MODE=LEGACY" username="sa" validationQuery="">********</datasource>
        <link global="jdbc/nuxeo" name="jdbc/NuxeoDS" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/nxsqldirectory" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/nxrelations-default-jena" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/comment-relations" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/nxaudit-logs" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/nxjbpm" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/placeful_service_ds" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/nxwebwidgets" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/nxuidsequencer" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/keyvaluestore" type="javax.sql.DataSource"/>
        <link global="jdbc/nuxeo" name="jdbc/repository_default" type="javax.sql.DataSource"/>
      </extension>